/**
 * Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.stylefeng.guns.modular.system.service.impl;

import cn.stylefeng.guns.core.util.DgObjToMap;
import cn.stylefeng.guns.modular.system.dao.UserMapper;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.service.IUserService;
import cn.stylefeng.roses.core.datascope.DataScope;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.swing.text.html.parser.Entity;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 管理员表 服务实现类
 * </p>
 *
 * @author stylefeng123
 * @since 2018-02-22
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public int setStatus(Integer userId, int status) {
        return this.baseMapper.setStatus(userId, status);
    }

    @Override
    public int changePwd(Integer userId, String pwd) {
        return this.baseMapper.changePwd(userId, pwd);
    }

    @Override
    public List<Map<String, Object>> selectUsers(DataScope dataScope, String name, String beginTime, String endTime, Integer deptid) {
        return this.baseMapper.selectUsers(dataScope, name, beginTime, endTime, deptid);
    }

    @Override
    public int setRoles(Integer userId, String roleIds) {
        return this.baseMapper.setRoles(userId, roleIds);
    }

    @Override
    public User getByAccount(String account) {
        return this.baseMapper.getByAccount(account);
    }
    /**
     * <b>查询本部门人员
     * </b><br><i>Description</i> :只查询本部门人员，不查询子部门的人员
     * @param dataScope DataScope
     * @param deptid Integer
     * @return List<Map<String,Object>>
     * <br>
     * <br><b>Throws</b> :
     * @date 2018年11月28日 下午3:12:28    <br><i>author</i> : dxl
    */
	@Override
	public List<Map<String, Object>> selectDeptUsers(Integer deptid) {
		return this.baseMapper.selectDeptUsers(deptid);
	}
	
	/**
     * <b>通过工号或邮件查询用户
     * </b><br><i>Description</i> :
     * @param user
     * @return User
     * <br>
     * <br><b>Throws</b> :
     * @date 2018年11月29日 下午8:32:16    <br><i>author</i> : dxl
    */
	@Override
	public User selectByJobnum(Integer jobnum) {
		return this.baseMapper.selectByJobnum(jobnum);
	}
	@Override
	public User selectByEmail(String email) {
		return this.baseMapper.selectByEmail(email);
	}
    
}
